using System;
using NHibernate;

namespace Sedna.Core.Persistence
{
	/// <summary>
	/// a part of the infrastructure that allows to create a NHibernate ICirteria instance out of
	/// internal filter state. Criteria builder might be useful to avoid unnecessary custom coding
	/// thus saving a great deal of work. However, not all IFilterState can be fed to it.
	/// The reuirement is so, that an IFilterState shall be either an instance of a <see cref="ICriteriaFilterState"/>
	/// or an instance of <see cref="IExternalCriteriaFilterState"/>.
	/// </summary>
	public interface IFilterCriteriaBuilder
	{
		/// <summary>
		/// Builds an instance of an ICriteria out of a specified IFilterState
		/// </summary>
		/// <param name="filterState">an instance of either a <see cref="ICriteriaFilterState"/> or <see cref="IExternalCriteriaFilterState"/></param>
		/// <param name="type">NHibernate persistent Type (i.e. persistent entity)</param>
		/// <param name="session">open and valid NHibernate ISession</param>
		/// <returns>an instance of a ICriteria that corresponds to internal filter state</returns>
		ICriteria Build(IFilterState filterState, Type type, ISession session);
	}
}
